<template>
    <div>
        <shouZhiModal  v-if="modalRef == 'shouZhiModalRef'" ref="shouZhiModalRef" :linkName="linkName" :passObj="passObj" @success="success"></shouZhiModal>
        <heTongModal  v-if="modalRef == 'heTongModalRef'" ref="heTongModalRef" @success="success"></heTongModal>

        <caiWuYuSuanModal  v-if="modalRef == 'caiWuYuSuanModalRef'" ref="caiWuYuSuanModalRef" :linkName="linkName" :passObj="passObj" @success="success"></caiWuYuSuanModal>

        <!-- 新 -->
        <baoXiaoModal v-if="modalRef == 'baoXiaoModalRef'" ref="baoXiaoModalRef" @success="success"/> <!-- 审核 -->
        <yiBanbaoXiaoModal v-if="modalRef == 'yiBanBaoXiaoModalRef'" ref="yiBanBaoXiaoModalRef" @success="success"/><!-- 一般报销（对公对私） -->
        <addBaoXiaoModal v-if="modalRef == 'addBaoXiaoModalRef'" ref="addBaoXiaoModalRef" @success="success"/>
        <reimbursementModel ref="reimbursementModelRef" /> <!-- 审评员报销 -->

        <yuSuanShenBao-department-Modal v-if="modalRef == 'yuSuanShenBaoDepartmentModalRef'" ref="yuSuanShenBaoDepartmentModalRef" @success="success"/>
        <yuSuanShenBao-finance-Modal v-if="modalRef == 'yuSuanShenBaoFinanceModalRef'" ref="yuSuanShenBaoFinanceModalRef" @success="success"/>
    </div>
</template>
<script>
import shouZhiModal from '../revenueAndExpenditure/baoXiao/index/handleModal'
import heTongModal from '../contract/contractPay/index/handleModal.vue'
import caiWuYuSuanModal from '../budget/allocate/index/applicationForm.vue'
//
import baoXiaoModal from '../newApplyFor/reimbursementApplication/increase'
import yiBanbaoXiaoModal from '../newApplyFor/generalReimbursement/index'
import addBaoXiaoModal from '../newApplyFor/reimbursement/reimbursementModel'
import reimbursementModel from '../../n-1-inspectorManage/expenseReimbursement/reimbursementModel.vue'
import yuSuanShenBaoDepartmentModal from '../budgetDeclaration/department/index'
import yuSuanShenBaoFinanceModal from '../budgetDeclaration/modal/index'
export default {
    components: {
        shouZhiModal,heTongModal,caiWuYuSuanModal,
        baoXiaoModal,
        yiBanbaoXiaoModal,
        addBaoXiaoModal,
        reimbursementModel,
        yuSuanShenBaoDepartmentModal,
        yuSuanShenBaoFinanceModal,
    },
    data() {
        return {
            linkName: '',
            passObj: {},
            Mxlist: [],
            addType: [
                {type: '收支',hjmc: '报销登记',ref: 'shouZhiModalRef'},
                {type: '合同',hjmc: '支付申请',ref: 'heTongModalRef',items:[]},
                {type: '财务预算',hjmc: '申请',ref: 'caiWuYuSuanModalRef',items:[]},
                //
                {type: '报销',hjmc: '申请',ref: 'baoXiaoModalRef'},
                {type: '一般报销',hjmc: '申请',ref: 'yiBanBaoXiaoModalRef',
                    items: {modalTitle:'新增报销'}},
                {type: '新增报销',hjmc: '申请',ref: 'addBaoXiaoModalRef',
                    items: {fpid:'',flcmb:'',view: false,heightType:'model'}},
                {type: '预算申报-部门',hjmc: '填写',ref: 'yuSuanShenBaoDepartmentModalRef'},

            ],
            modalRef: ''
        }
    },
    methods: {
        addClick(type){
            let nameRef = ''
            this.addType.forEach(item => {
                if(item.type == type){
                    //console.log('1111111',item)
                    nameRef = item.ref
                    this.modalRef = nameRef
                    this.linkName = item.hjmc
                    this.$nextTick(_ => {
                        //console.log(this.$refs[nameRef])
                        this.$refs[nameRef].getData({...item.items},{})
                        this.$refs[nameRef].visible = true
                    })
                }
            })
        },
        modalClick(row){
            //console.log(row)
            this.linkName = row.hjmc
            this.passObj = {
                ...row.oaMap,
                oaid: row.oaMap.id,
                jobid: row.jobMap?row.jobMap.id:''
            }
            this.Mxlist = row.mxList?row.mxList:[]
            let nameRef = row.pageMap.ref
            this.modalRef = nameRef
            this.$nextTick(_ => {
                this.$refs[nameRef].getData(row,this.passObj)
                this.$refs[nameRef].visible = true
            })
        },
        applicationClick(data,Ref){
            //console.log(data,Ref)
            this.modalRef = Ref
            let nameRef = Ref
            //console.log('modalRef',Ref.typeof,this.modalRef)
            //console.log(this.$refs[nameRef])
            this.$nextTick(_ => {
                this.$refs[nameRef].getApplicationData(data)
                this.$refs[nameRef].visible = true
            })

        },
        reimburseClick(row){
            this.$refs.reimbursementModelRef.getData({sqsxid:row.fsqsxid,bxdid: row.bxdid,view:false,heightType:'model'})
            this.$refs.reimbursementModelRef.visible = true
        },
        success(){
            //console.log('success-resetEvent')
            this.$emit('resetEvent')
        }
    },
}
</script>
